package zx.x.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.app.entity.OrderJobLogEntity;
import zx.x.modules.app.service.OrderJobLogService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 订单分红日志表
 *
 * @author x
 * @email x
 * @date 2022-12-16 19:13:37
 */
@RestController
@RequestMapping("app/orderjoblog")
public class OrderJobLogController {
    @Autowired
    private OrderJobLogService orderJobLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("app:orderjoblog:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderJobLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("app:orderjoblog:info")
    public R info(@PathVariable("id") Integer id){
		OrderJobLogEntity orderJobLog = orderJobLogService.getById(id);

        return R.ok().put("orderJobLog", orderJobLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("app:orderjoblog:save")
    public R save(@RequestBody OrderJobLogEntity orderJobLog){
		orderJobLogService.save(orderJobLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("app:orderjoblog:update")
    public R update(@RequestBody OrderJobLogEntity orderJobLog){
		orderJobLogService.updateById(orderJobLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("app:orderjoblog:delete")
    public R delete(@RequestBody Integer[] ids){
		orderJobLogService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
